﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using SouthApps.MobileTasks.SDK.DAL.Repositories;
using SouthApps.MobileHealth.SDK.DAL;
using SouthApps.MobileHealth.SDK.DAL.Model;
using SouthApps.MobileHealth.SDK.Utils;
using SouthApps.MobileHealth.SDK.Cache;

namespace SouthApps.MobileHealth.SDK.Services
{
    public class AdministrationService
    {
        private IAdministrationRepository administrationRepository;

        public AdministrationService()
        {
            this.administrationRepository = new AdministrationRepository();
        }

        public void AddPlatform(Platform platform)
        {
            this.administrationRepository.AddPlatform(platform);
        }

        public void AddPlatformLicense(PlatformLicense platformLicense)
        {
            this.administrationRepository.AddPlatformLicense(platformLicense);
        }

        public List<Platform> GetPlatforms()
        {
            return this.administrationRepository.GetPlatforms();
        }

        public Platform GetPlatform(string platformName)
        {
            return this.administrationRepository.GetPlatform(platformName);
        }

        public bool IsPlatformLicensed(int licensedEntityId, int platformId)
        {
            return this.administrationRepository.GetEntityPlatformLicense(licensedEntityId, platformId) !=null;
        }

        public List<PlatformLicense> GetEntityPlatformLicenses(int licensedEntityId)
        {
            return this.administrationRepository.GetEntityPlatformLicenses(licensedEntityId);
        }

        public List<Server> GetServers()
        {
            return this.administrationRepository.GetServers();
        }

        public void ModifyPlatform(Platform platform)
        {
            this.administrationRepository.ModifyPlatform(platform);
        }

        public void ModifyPlatformLicense(PlatformLicense platformLicense)
        {
            this.administrationRepository.ModifyPlatformLicense(platformLicense);
        }
    }
}
